import { createApp } from "vue";
import { createPinia } from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";

import App from "./App.vue";
import router from "./router";

// 引入初始样式文件
import "@/styles/common.scss";
import { lazyPlugin } from "./directives";

// 引入懒加载组件并注册

const app = createApp(App);
// 全局组件插件
import { componentPlugin } from "./components";
app.use(componentPlugin);

const pinia = createPinia();
// 注册持久化插件
pinia.use(piniaPluginPersistedstate);

app.use(pinia);
app.use(router);

app.use(lazyPlugin);

app.mount("#app");

// 定义全局指令
